package dryven.request.controller.paramtransform.baseimpl;

import java.lang.annotation.Annotation;

import dryven.model.binding.form.FormValidation;
import dryven.request.controller.paramtransform.ActionParameterBindCandidate;
import dryven.request.controller.paramtransform.ActionParameterTransformFeedback;
import dryven.request.http.Request;
import dryven.request.http.Response;

public class FormValidationNullValueBinder implements ActionParameterBindCandidate {

	@Override
	public boolean canApply(Class<?> type, Annotation[] annotations) {
		return type.equals(FormValidation.class);
	}

	@Override
	public void apply(Class<?> type, Annotation[] annotations,
			Object currentValue, Request request, Response response,
			ActionParameterTransformFeedback feedback) {
		//just pass along the current value
		feedback.setParameter(currentValue);
	}

	@Override
	public boolean isValueGenerator() {
		return true;
	}

	@Override
	public String serializeParameter(Object o) {
		return null;
	}

}
